
<form class="form-horizontal" role="form" style="padding: 20px;" id="ad_edit_dialog_form" method="post" action="/b/ad/edit">

    <div class="form-group">
        <label class="col-sm-2 control-label">名称：</label>
        <div class="col-sm-8">
            <input type="hidden" name="id" value="{{.ad.Id}}">
            <input name="name" class="easyui-textbox form-control" value="{{.ad.Name}}" type="text" data-options="required:true"/>
        </div>
    </div>

    <div class="form-group">
        <label class="col-sm-2 control-label">所属广告位：</label>
        <div class="col-sm-8">
            <select name="space_id" class="easyui-combobox form-control" data-options="required:true">
                {{range $k,$v := .adspaces}}
                    <option value="{{$v.Id}}" {{if eq $v.Id $.ad.SpaceID}} selected {{end}}>{{$v.Name}}</option>
                {{end}}
            </select>
        </div>
    </div>

    <div class="form-group">
        <label class="col-sm-2 control-label">图片：</label>
        <div class="col-sm-8">
            {{.imageUploader}}
        </div>
    </div>



    <div class="form-group">
        <label class="col-sm-2 control-label">链接：</label>
        <div class="col-sm-8">
            <input name="link_url"  class="easyui-textbox form-control" value="{{.ad.LinkUrl}}" type="text"/>
        </div>
    </div>

    <div class="form-group">
        <label class="col-sm-2 control-label">开始时间：</label>
        <div class="col-sm-8">
            <input name="start_time"  class="easyui-datetimebox form-control" value="{{.ad.StartTime}}" type="text"/>
        </div>
    </div>

    <div class="form-group">
        <label class="col-sm-2 control-label">结束时间：</label>
        <div class="col-sm-8">
            <input name="end_time"  class="easyui-datetimebox  form-control" value="{{.ad.EndTime}}" type="text"/>
        </div>
    </div>

    <div class="form-group">
        <label class="col-sm-2 control-label">排序：</label>
        <div class="col-sm-8">
            <input name="listorder" class="easyui-textbox form-control" value="{{.ad.ListOrder}}" type="text" />
        </div>
    </div>

    <div class="form-group">
        <label class="col-sm-2 control-label">是否启用：</label>
        <div class="col-sm-8">
            <input class="easyui-switchbutton form-control" {{if eq .ad.Status 1}}checked{{end}} name="status" data-options="onText:'是',offText:'否'">
        </div>
    </div>


</form>


<script type="text/javascript">
    function adListEditDialogFormSubmit() {
        $("#ad_edit_dialog_form").form("submit", {
            success: function (res) {
                res = JSON.parse(res)
                if (res.errcode) {
                    $.messager.alert('提示信息', res.errmsg, 'error');
                } else {
                    $.messager.alert('提示信息', res.errmsg, 'info');
                    $('#ad_list_add_dialog').dialog('close');
                    adListRefresh();
                }
            }
        })
    }

</script>
